<?php use_stylesheets_for_form($form) ?>
<?php use_javascripts_for_form($form) ?>

<form action="<?php echo url_for('contribuyente/'.($form->getObject()->isNew() ? 'create' : 'update').(!$form->getObject()->isNew() ? '?id='.$form->getObject()->getId() : '')) ?>" method="post" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?>>
<?php if (!$form->getObject()->isNew()): ?>
<input type="hidden" name="sf_method" value="put" />
<?php endif; ?>
  <table class="formulario" >
    <tbody>
      <?php echo $form->renderGlobalErrors() ?>
      <tr>
          <th width="20%" ><?php echo $form['apellido']->renderLabel() ?></th>
        <td>
          <?php echo $form['apellido']->renderError() ?>
          <?php echo $form['apellido']->render(array("style"=>"width:60%; text-transform: uppercase"))?>
        </td>
      </tr>
      <tr>
         <th width="20%" ><?php echo $form['nombre']->renderLabel() ?></th>
        <td>
          <?php echo $form['nombre']->renderError() ?>
          <?php echo $form['nombre'] ->render(array("style"=>"width:60%; text-transform: uppercase"))?>
        </td>
      </tr>
      <tr>
          <th width="20%" ><?php echo $form['cuit']->renderLabel() ?></th>
        <td>
          <?php echo $form['cuit']->renderError() ?>
          <?php echo $form['cuit'] ->render(array("onkeyup"=>"formatear(this, '##-########-#')","maxlength"=>"13")) ?>
        </td>
      </tr>
      <tr>
          <th width="20%" ><?php echo $form['dni']->renderLabel() ?></th>
        <td>
          <?php echo $form['dni']->renderError() ?>
          <?php echo $form['dni'] ?>
        </td>
      </tr>
      <tr>
           <td  colspan="3" >
              <fieldset style = "width:100%; height:150;border:solid 1px" >
                 <legend>Direccion de Servicio</legend>
                 <table  width="98%"  >
                     <tr>
           
        <th><?php echo $form['nro']->renderLabel() ?></th>
        <td>
          <?php echo $form['nro']->renderError() ?>
          <?php echo $form['nro'] ?>
        </td>
      </tr>
      <tr>
        <th><?php echo $form['mbk']->renderLabel() ?></th>
        <td>
          <?php echo $form['mbk']->renderError() ?>
          <?php echo $form['mbk'] ?>
        </td>
      </tr>
      <tr>
        <th><?php echo $form['piso']->renderLabel() ?></th>
        <td>
          <?php echo $form['piso']->renderError() ?>
          <?php echo $form['piso'] ?>
        </td>
      </tr>
      <tr>
        <th><?php echo $form['dpto']->renderLabel() ?></th>
        <td>
          <?php echo $form['dpto']->renderError() ?>
          <?php echo $form['dpto'] ?>
        </td>
      </tr>
       <tr style="display: none">
        <th><?php echo $form['calle_id']->renderLabel() ?></th>
        <td>
          <?php echo $form['calle_id']->renderError() ?>
          <?php echo $form['calle_id'] ?>
        </td>
      </tr>
       <tr>
                   
          <th style="  font-weight: bold;color: #000">Calle</th>
           <td >  
               <?php if (!$form->getObject()->isNew()): ?>
                 <input id="nombrecalle" style = "width:90%;" readOnly="readOnly" type="text" size="20px" value="<?php echo  $form->getObject()->getCalle() ?>">
               <?php else: ?>
                 <input id="nombrecalle" style = "width:90%;" readOnly="readOnly" type="text" size="20px" >
               <?php endif; ?>
               <a href="#"><img src="/images/ver.png" onclick="abrirVentana('<?php echo url_for("contribuyente/buscarCalle")?>','Buscar','','800','400')"></a>
          </td>
      </tr>
      <tr style="display:none ">
        <th><?php echo $form['barrio_id']->renderLabel() ?></th>
         <td >
          <?php echo $form['barrio_id']->renderError() ?>
          <?php echo $form['barrio_id'] ?>
        </td>
      </tr>
           <tr>
          <th style="  font-weight: bold;color: #000">Barrio</th>
           <td>  
               <?php if (!$form->getObject()->isNew()): ?>
                  <input id="nombrebarrio" style = "width:90%;" readOnly="readOnly" type="text" size="20px" value="<?php echo  $form->getObject()->getBarrio()?>">
               <?php else: ?>
                  <input id="nombrebarrio" style = "width:90%;" readOnly="readOnly" type="text" size="20px">
               <?php endif; ?>
               <a href="#"><img src="/images/ver.png" onclick="abrirVentana('<?php echo url_for("contribuyente/buscarBarrio")?>','Buscar','','800','400')"></a>
          </td>
      </tr>
                     
                 </table>
                 
              </fieldset>
          </td>
              
      </tr> 
       <?php if (!$form->getObject()->isNew()): ?>   
      <tr>
          <th style="  font-weight: bold;color: #000">Teléfono</th>
           <td>  
                        
               <a href="#"><img src="/images/new.png" onclick="abrirVentana('<?php echo url_for("telefono/index?id=".$form->getObject()->getId())?>','Buscar','','800','400')"></a>
          
           </td>
      </tr>
       <?php endif; ?>
     </tbody>
     <tfoot>
      <tr>
        <td colspan="2">
          <?php echo $form->renderHiddenFields(false) ?>
          &nbsp;<a style=" text-decoration:none;   "href="<?php echo url_for('contribuyente/index') ?>">Volver</a>
         
          <input type="submit" value="Aceptar" onmouseover="style.cursor=cursor"/>
        </td>
      </tr>
    </tfoot>
  </table>
</form>
